/**
 * Copyright (c) 2018 开源 All rights reserved.
 * <p>
 * https://www.chengcang.com
 * <p>
 * 版权所有，侵权必究！
 */

package com.chengcang.admin.modules.sys.dto;

import com.chengcang.admin.modules.sys.entity.UserTenant;
import com.chengcang.common.validator.group.AddGroup;
import com.chengcang.common.validator.group.DefaultGroup;
import com.chengcang.common.validator.group.UpdateGroup;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * 用户管理
 *
 * @author zhanli
 * @since 1.0.0
 */
@Data
@ApiModel(value = "用户管理")
public class SysUserDTO implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "id")
    @Null(message = "{id.null}", groups = AddGroup.class)
    @NotNull(message = "{id.require}", groups = UpdateGroup.class)
    private Long id;

    @ApiModelProperty(value = "用户编号")
    private String userCode;

    @ApiModelProperty(value = "用户名", required = true)
    @Null(message = "{sysuser.username.require}", groups = AddGroup.class)
    private String username;

    @ApiModelProperty(value = "密码")
    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
    @NotBlank(message = "{sysuser.password.require}", groups = AddGroup.class)
//    @Range(max = 33, message = "{sysuser.password.length}", groups = DefaultGroup.class)
    private String password;

    @ApiModelProperty(value = "姓名", required = true)
//    @NotBlank(message = "{sysuser.realname.require}", groups = DefaultGroup.class)
    private String realName;

    @ApiModelProperty(value = "头像")
    private String headUrl;

    @ApiModelProperty(value = "性别   0：男   1：女    2：保密", required = true)
    @Range(min = 0, max = 2, message = "{sysuser.gender.range}", groups = DefaultGroup.class)
    private Integer gender;

    @ApiModelProperty(value = "出生日期")
    private Date birth;

    @ApiModelProperty(value = "微信")
    private String wechat;

    @ApiModelProperty(value = "籍贯")
    private String nativePlace;

    @ApiModelProperty(value = "学历 0 初中 1 高中 2 大专 3 本科 4 研究生")
    private String education;

    @ApiModelProperty(value = "学历名称")
    private String educationName;

    @ApiModelProperty(value = "专业")
    private String major;

    @ApiModelProperty(value = "毕业学校")
    private String school;

    @ApiModelProperty(value = "毕业时间")
    private Date graduationDate;

    @ApiModelProperty(value = "邮箱")
    @Email(message = "{sysuser.email.error}", groups = DefaultGroup.class)
    private String email;

    @ApiModelProperty(value = "手机号")
//    @Range(min = 10, max = 12, message = "{sysuser.mobile.length}", groups = DefaultGroup.class)
    @NotNull(message = "{sysuser.mobile.require}", groups = DefaultGroup.class)
    private String mobile;

    @ApiModelProperty(value = "部门ID", required = true)
    private Long deptId;

    @ApiModelProperty(value = "状态  0：启用    1：禁用", required = true)
    @Range(min = 0, max = 1, message = "{sysuser.status.range}", groups = DefaultGroup.class)
    private Integer status;

    @ApiModelProperty(value = "状态  启用、禁用")
    private String statusName;

    @ApiModelProperty(value = "创建时间")
    @JsonProperty(access = JsonProperty.Access.READ_ONLY)
    private Date createDate;

    @ApiModelProperty(value = "超级管理员   0：否   1：是")
    @JsonProperty(access = JsonProperty.Access.READ_ONLY)
    private Integer defaultUserType;

    @ApiModelProperty(value = "用户类型名称")
    private String userTypeName;

    @ApiModelProperty(value = "注册渠道")
    private Integer source;

    @ApiModelProperty(value = "注册渠道名称")
    private String sourceName;

    @ApiModelProperty(value = "角色ID")
    private Long roleId;

    @ApiModelProperty(value = "角色名称")
    private String roleName;

    @ApiModelProperty(value = "部门名称")
    private String deptName;

    @ApiModelProperty(value = "默认客户ID")
    private Long defaultTenantId;

    @ApiModelProperty(value = "默认客户类型")
    private Integer defaultTenantType;

    @ApiModelProperty(value = "客户ID列表")
    private List<UserTenant> tenantList;

    @ApiModelProperty(value = "备注")
    private String remark;

    @ApiModelProperty(value = "最后登陆时间")
    private Date lastLoginTime;

    private String deptIds;

}
